#ifndef ENTITY_H
#define ENTITY_H

#include <d3dx9math.h>

#include "CubeVolume.h"
#include "Mesh.h"
#include "SerialData.h"
#include "Serializable.h"

class Entity : public Serializable
{
public:
	friend class Network;
	friend class World;

	Entity();

	void MovePos(float _x, float _y, float _z);

	void setPosition(float _x, float _y, float _z);
	void setVelocity(float _x, float _y, float _z);

	void SetCube();
	CubeVolume* GetCube()			{return m_Cube;}

	virtual void Update(float _DeltaT);
	virtual void Render();

	virtual void ToTick(long tick){}

protected:
    struct EntityData
    {
		//D3DMATRIX Matrix;	//D3DXMATRIX isn't POD due to all the constructors and overloaded operators, D3DMATRIX however is POD
							//Luckily a D3DXMATRIX can be set to a D3DMATRIX and vice versa, so cast to D3DX when performing
							//transforms then convert straight back afterwards
		D3DMATRIX Matrix, RotationX, RotationY, RotationZ;
    };

	SerialData<EntityData> m_data;

	Mesh *m_Mesh;
	CubeVolume * m_Cube;
};

#endif // ENTITY_H
